package com.ruoyi.tester.executor.expression;

import com.ruoyi.tester.executor.ExpressionContext;
import org.springframework.stereotype.Component;

/**
 * @author SongJun
 * @description TODO:
 * @date 2022/6/2 14:39
 */
@Component
public class ExpExist implements ExpressionAnalysis {
    @Override
    public String getExpressionName() {
        return "exist";
    }

    @Override
    public String getDescription() {
        return "exist() 返回当前上下文是否存在(不等于null);";
    }

    @Override
    public Object analysis(ExpressionContext context, String... param) {
        String strBody = context.getContext().toString();
        return strBody != null;
    }
}
